/**
 *
 */
package andersonb.deserto;

import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.util.jndi.JndiContext;

import andersonb.pojos.ArquivaPropostaAceita;
import andersonb.pojos.ArquivaPropostaFutura;
import andersonb.routebuilders.LogaMensagem;
import andersonb.routebuilders.RotaAnderson;
import andersonb.routebuilders.TraduzTransporte;

/**
 * @author Anderson Bernardo
 */
public class CamelStartup {

	/**
	 * @param args
	 * @throws Exception
	 */
	public static void main(final String[] args) throws Exception {
		DefaultCamelContext camelContext = new DefaultCamelContext();
		camelContext.addRoutes(new RotaAnderson());
		adicionaBeans(camelContext);
		camelContext.start();
	}

	/**
	 * @param contexto
	 * @throws Exception
	 */
	private static void adicionaBeans(final DefaultCamelContext contexto)
			throws Exception {
		JndiContext jc = new JndiContext();
		jc.bind("propostaAceita", new ArquivaPropostaAceita());
		jc.bind("propostaFutura", new ArquivaPropostaFutura());
		jc.bind("tradutor", new TraduzTransporte());
		jc.bind("tap", new LogaMensagem());
		contexto.setJndiContext(jc);
	}

}
